X-Git-Url: https://git.r.bdr.sh/rbdr/super-polarity/blobdiff_plain/097781e6ad3f7bb1c13c16ff7b6bb7219764fb29..b587e9d8e0cc5eb1edf972fd3b644704441e5289:/Super%20Polarity/SuperPolarity.cs?ds=sidebyside diff --git a/Super Polarity/SuperPolarity.cs b/Super Polarity/SuperPolarity.cs index 6689167..8125f8c 100644 --- a/Super Polarity/SuperPolarity.cs +++ b/Super Polarity/SuperPolarity.cs @@ -7,6 +7,8 @@ using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using Microsoft.Xna.Framework.Storage; using Microsoft.Xna.Framework.GamerServices; +using Microsoft.Xna.Framework.Media; +using Microsoft.Xna.Framework.Audio; using SuperPolarity; #endregion @@ -26,7 +28,9 @@ namespace SuperPolarity Screen EntryScreen; - SpriteFont DebugFont; + protected Song TitleSong; + protected Song GameSong; + protected SoundEffect GameOverSound; public SuperPolarity() : base() @@ -43,7 +47,7 @@ namespace SuperPolarity ActorManager.SetGame(this); ScreenManager.SetGame(this); - EntryScreen = (Screen)new GameScreen(this); + EntryScreen = (Screen)new TitleScreen(this); } /// @@ -60,7 +64,6 @@ namespace SuperPolarity InputController.Bind("fullScreenToggle", HandleFullScreenToggle); EntryScreen.Initialize(); - ScreenManager.Push(EntryScreen); OutlierBounds = 100; } @@ -77,13 +80,17 @@ namespace SuperPolarity /// protected override void LoadContent() { + + MediaPlayer.IsRepeating = true; + GameSong = Content.Load("Sound\\polaritytheme.wav"); + GameOverSound = Content.Load("Sound\\gameover"); + // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); - EntryScreen.LoadContent(); + ScreenManager.Push(EntryScreen); - Player = new Player(); - DebugFont = Content.Load("Fonts\\SegoeUIMono14"); + Player = new Player(this); } /// @@ -107,6 +114,8 @@ namespace SuperPolarity ScreenManager.Update(gameTime); + Player.Update(); + base.Update(gameTime); } @@ -122,13 +131,25 @@ namespace SuperPolarity ScreenManager.Draw(spriteBatch); - spriteBatch.DrawString(DebugFont, "Score: " + Player.Score.ToString(), new Vector2(10, 10), Color.LightGray); - spriteBatch.DrawString(DebugFont, "Multiplier: " + Player.Multiplier.ToString(), new Vector2(10, 30), Color.LightGray); - spriteBatch.DrawString(DebugFont, "Lives: " + Player.Lives.ToString(), new Vector2(10, 50), Color.LightGray); - spriteBatch.End(); base.Draw(gameTime); } + + public void PlaySong(string songName) + { + // temp stuff before media manager is in + if (songName == "game") + { + MediaPlayer.Play(GameSong); + } + } + + public void GameOver() + { + MediaPlayer.Stop(); + GameOverSound.Play(); + ScreenManager.Pop(); + } } }